<div id="main-content" class="box border grey">
    <form name="userProfile">
        <div class="box-title">
            <h4>个人名片维护</h4>
            <div class="tools">
                <button ng-show="!edit" class="btn btn-xs btn-success" ng-click="edit=true">编辑</button>
                <span ng-show="edit">
                    <a class="btn btn-xs btn-success" ng-click="updateProfile()" ng-disabled="userProfile.$invalid">保存</a>
                    <a class="btn btn-xs btn-success" ng-click="reset()">重置</a>
                    <button ng-show="edit" class="btn btn-xs btn-success" ng-click="edit=false;reset()">取消编辑</button>
                </span>
            </div>
        </div>
        <div class="box-body">
            <div class="row">
                <div class="col-md-6">
                    <div class="box-title padding-top-8 margin-top-5 no-margin-bottom bk-green" ng-repeat-start="divItem in profileStruct">
                        <h4>{{divItem.name}}</h4>
                        <div class="tools" ng-show="edit">
                            <a ng-if="divItem.type=='repeat'" ng-click="addElement(profilePointer[divItem.blockName])"><i class="fa fa-plus"></i></a>
                        </div>
                    </div>
                    <div class="box-body border" ng-repeat-end>
                        <div ng-if="divItem.type=='normal'" traversal-datastruct info-struct="divItem.struct"  info-traversal="profilePointer[divItem.blockName]" offset="0" blockname="{{divItem.blockName}}" special-need="{{edit?'WriteOnly':'ReadOnly'}}" dirty-set="dirtySet(index)" style="padding-left: 8px;padding-right: 8px"></div>
                        <div ng-if="divItem.type=='repeat'" repeat-datastruct info-struct="divItem.struct"  info-traversal="profilePointer[divItem.blockName]" blockname="{{divItem.blockName}}" pre-name="{{divItem.preName}}" special-need="{{edit?'WriteOnly':'ReadOnly'}}" dirty-set="dirtySet(index)"  style="padding-left: 8px;padding-right: 8px"></div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="box-title" >
                        图片列表
                        <div class="tools" ng-show="edit">
                            <a ng-click="addElement(profilePointer.photoList)"><i class="fa fa-plus"></i></a>
                        </div>
                    </div>
                    <div class="box-body row">
                        <div class="col-md-4">
                            <img width="100%" ng-src="{{presentProfile.photoUrl}}"/>
                        </div>
                        <div class="col-md-8">
                            <table class="table border table-hover">
                                <tr>
                                    <th>名称</th>
                                    <td>
                                        <span>用户头像</span>
                                    </td>
                                </tr>
                                <tr>
                                    <th>简介</th>
                                    <td>
                                        <span>可以在此处上传用户头像</span>
                                    </td>
                                </tr>
                            </table>
                            <div ng-show="edit">
                                <input type="file" ngf-select ng-model="presentProfile.$$photo" ng-show="presentProfile.$$photo==undefined" name="file" ngf-pattern="'image/*'" ngf-accept="'image/*'" ng-change="submit(presentProfile,true)" ></a>
                            </div>
                        </div>
                    </div>
                    <div class="box-body row" ng-repeat="item in profilePointer.photoList">
                        <div class="col-md-4">
                            <img width="100%" ng-show="item.path" ng-src="{{item.path}}"/>
                        </div>
                        <div class="col-md-8">
                            <table class="table border table-hover">
                                <tr>
                                    <th>名称&nbsp;<span class="font-red">*</span></th>
                                    <td>
                                        <span ng-show="!edit">{{item.name}}</span>
                                        <input ng-show="edit" type="text" class="form-control" ng-model="item.name" required>
                                    </td>
                                </tr>
                                <tr>
                                    <th>简介</th>
                                    <td>
                                        <span ng-show="!edit">{{item.remark}}</span>
                                        <input ng-show="edit" type="text" class="form-control" ng-model="item.remark">
                                    </td>
                                </tr>
                            </table>
                            <div class="text-center row" ng-show="edit">
                                <div class="col-md-4">
                                    <button  class="btn btn-warning btn-xs" ng-click="deletePhoto(item)">删除</button>
                                </div>
                                <div class="col-md-8">
                                    <input type="file" ngf-select ng-model="item.$$photo" ng-show="item.$$photo==undefined" name="file" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="1MB" ngf-min-height="40" ng-change="submit(item)" ></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>